home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Initialize.c
-
- Contains: Initialization code for this application
-
- Written by: Chris White, Developer Technical Support
-
- Copyright: © 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- 03/29/96 CW First release
-
- */
-
-
- #pragma segment Initialize
-
-
-
- // System includes
-
- #ifndef __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
- #ifndef __FONTS__
- #include <Fonts.h>
- #endif
-
- #ifndef __TEXTEDIT__
- #include <TextEdit.h>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __GESTALT__
- #include <Gestalt.h>
- #endif
-
- #ifndef __SEGLOAD__
- #include <SegLoad.h>
- #endif
-
-
-
-
- // Application includes
-
- #ifndef __BAREBONES__
- #include "BareBones.h"
- #endif
-
- #ifndef __PROTOTYPES__
- #include "Prototypes.h"
- #endif
-
-
-
- // static prototypes
- static SInt16 CheckConfiguration ( void );
-
-
-
-
- void InitToolbox ( void )
- {
-
- InitGraf ( &qd.thePort );
- InitFonts ( );
- InitWindows ( );
- InitMenus ( );
- TEInit ( );
- InitDialogs ( nil );
- InitCursor ( );
-
- FlushEvents ( everyEvent, 0 );
-
- return;
- }
-
-
-
- void InitApplication ( void )
- {
- SInt16 messageCode;
-
-
- SetMenuBar ( GetNewMBar ( kMenuBarID ) );
- AddResMenu ( GetMHandle ( kAppleMenu ), 'DRVR' );
- DrawMenuBar ( );
-
- messageCode = CheckConfiguration ( );
- if ( messageCode )
- {
- AlertUser ( messageCode, 0, nil );
- ExitToShell ( );
- }
-
- gQuit = false; // Initialize flag that controls main event loop
- gInBackground = false;
- gSleepTime = kSleepTime;
-
- InstallAppleEventHandlers ( );
- CreateWindow ( );
-
- // Create any other RoutineDescriptors we may need
- gScrollControlActionUPP = NewControlActionProc ( ScrollControlActionProc );
- gScrollThumbActionUPP = NewIndicatorActionProc ( ScrollThumbActionProc );
-
- return;
- }
-
-
-
- static SInt16 CheckConfiguration ( void )
- {
- SInt16 messageCode = 0;
- SInt32 theResult;
- OSErr theErr;
-
-
- // Verify that we can run on the current configuration
-
- // We require AppleEvent Manager and color Quickdraw
- theErr = Gestalt ( gestaltAppleEventsAttr, &theResult );
- if ( !(theErr == noErr && (theResult & (1L << gestaltAppleEventsPresent)) ))
- messageCode = kNeedSystem7;
-
- theErr = Gestalt ( gestaltQuickdrawFeatures, &theResult );
- if ( !(theErr == noErr && (theResult & (1L << gestaltHasColor)) ))
- messageCode = kNeedColorQuickdraw;
-
-
- return messageCode;
- }
-
-
-
-
-